home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / dinkum3 / opener.c < prev    next >
C/C++ Source or Header  |  1995-05-03  |  31KB  |  1,212 lines

  1. #define OPNR
  2. #include "dink_sym.h"
  3. #include "dink_glb.h"
  4.  
  5. #if (PROTOTYPE)
  6. void dialer(int n)
  7. #else
  8. dialer(n)
  9. int n ;
  10. #endif
  11. /*****************************/
  12. /*      "dial" command"      */
  13. /*     Version:  Mk 1.1      */
  14. /*      29 October 1989      */
  15. /*****************************/
  16. {
  17.  
  18. /* deal with the question of "What is the combination?" */
  19. if (tag[V_what]) {
  20. printf("I really don't know.  You might try looking around for a\n") ;
  21. printf("series of numbers. Sometimes that can be a clue to the\n") ;
  22. printf("actual combination.\n") ;
  23.     return ;
  24. }
  25.  
  26. /* See if the combination was dialed in the right place */
  27. if ((n == R_office_mang)&&(Picture->Status >= S_open)) {
  28.     if (tag[V_0] && tag[V_49] && tag[V_67] && tag[V_82]) {
  29.         printf ("Click!! \n");
  30.         Safe->Status = S_dialed ;
  31.         return ; 
  32.     }
  33. printf ("You turned the dial but nothing happened.  I think you \n");   
  34. printf ("dialed the wrong thing. \n");
  35.     return ; 
  36. }
  37. printf ("How am I supposed to dial that? \n");
  38. } /* --- end of the "dialer" subroutine --- */
  39.  
  40.  
  41. #if (PROTOTYPE)
  42. void inventer(void)
  43. #else
  44. inventer()
  45. #endif
  46. /*****************************/
  47. /*   "inventory" command     */
  48. /*     Version:  Mk 1.0      */
  49. /*       11 March 1989       */
  50. /*****************************/
  51. {
  52. #if (PROTOTYPE)
  53. void objector(OBJECT_STRUCT*) ;
  54. #endif
  55.  
  56. register int i;
  57. int j_ws ;
  58. OBJECT_STRUCT *pnt, *point ;
  59.  
  60. j_ws = 0 ;
  61. pnt = object ;
  62. for (i = 0; i < Objcnt; i++) {
  63.     if ((pnt++)->Location == B_have) {
  64.         ++j_ws ;
  65.         point = (pnt - 1) ;
  66.     }
  67. }
  68. if ((j_ws == 0)&&(gleep_count == 0)) {
  69.     printf("You've got NOTHING!! \n") ;
  70.     return ;
  71. }
  72. if (j_ws >= 1) {
  73.     if (j_ws == 1) {
  74.         printf("You are carrying ") ;
  75.         objector(point);
  76.         printf ("\n") ;
  77.     }
  78.     else {
  79.         printf ("You are carrying the following: \n");
  80.         pnt = object ;
  81.         for (i = 0; i < Objcnt; i++) {
  82.             if ((pnt++)->Location == B_have) {
  83.                 printf("        ") ;
  84.                 point = (pnt - 1) ;
  85.                 objector(point);
  86.                 printf("\n") ;
  87.             }
  88.         }
  89.     }
  90. }
  91. if (gleep_count > 0) {
  92.     if (gleep_count == 1) {
  93.         printf("You have one gleep.\n") ;
  94.         return ;
  95.     }
  96.     printf("You are carrying %d gleeps. \n",gleep_count) ;
  97. }
  98.  
  99. } /* --- end of the "inventor" subroutine --- */
  100.  
  101. #if (PROTOTYPE)
  102. void drinker(void)
  103. #else
  104. drinker()
  105. #endif
  106. /*****************************/
  107. /*     "drink" command       */
  108. /*     Version:  Mk 1.0      */
  109. /*       11 March 1989       */
  110. /*****************************/
  111. {
  112. #if (PROTOTYPE)
  113. void no_booze(void) ;
  114. #endif
  115.  
  116. if (tag[V_can]) {
  117.     if (Can->Location == B_have) {
  118.         printf("The XXXX keeps on coming on ? \n") ;
  119. printf("I think not, for there is no Fourex left for me to drink!\n") ;
  120.     }
  121.     else no_booze() ;
  122.     return ;
  123. }
  124.  
  125. if (tag[V_bottle]) {
  126.     if (Bottle->Location == B_have) {
  127. printf("Some greedy larrikin has drunk up all of the Black Swan! \n") ;
  128.     printf("Bad on Him! There is none left for me! \n") ;
  129.     return ;
  130.     }
  131.     no_booze() ;
  132.     return ;
  133. }
  134.  
  135. if (tag[V_water]) {
  136.     printf("There is no water here that I am willing to drink.\n") ;
  137.     return ;
  138. }
  139.     
  140. printf ("What exactly do you want me to drink? \n");
  141. return; 
  142.  
  143. } /* --- end of the "drinker" subroutine --- */
  144.  
  145. #if (PROTOTYPE)
  146. void no_booze(void)
  147. #else
  148. no_booze()
  149. #endif
  150. /*****************************/
  151. /*     Version:  Mk 1.0      */
  152. /*     7 December 1992       */
  153. /*****************************/
  154. {
  155. printf ("You don't have it in your possession to drink!\n");
  156. return ;
  157. } /* --- end of the "no_booze" subroutine --- */
  158.  
  159.  
  160. #if (PROTOTYPE)
  161. void reader(int n)
  162. #else
  163. reader(n)
  164. int n ;
  165. #endif
  166. /*****************************/
  167. /*      "read" command       */
  168. /*     Version:  Mk 1.2      */
  169. /*      23 December 1992     */
  170. /*****************************/
  171. {
  172. register int i ;
  173. int m, sw_no_see ;
  174.  
  175. OBJECT_STRUCT *point ;
  176. READ_STRUCT *pnt ;
  177.  
  178. #if (PROTOTYPE)
  179. void rdtxt(int) ;
  180. OBJECT_STRUCT* point_to_object(int) ;
  181. #else
  182. OBJECT_STRUCT* point_to_object() ;
  183. #endif
  184.  
  185. /* reject an isolated "read" command */
  186. if (tag[V_VERB_ONLY]) { 
  187.         printf ("What exactly do you want me to read? \n");
  188.         return;
  189. }
  190.  
  191. sw_no_see = FALSE ;
  192. pnt = read_object ;
  193. for (i = 0; i < Read_objcnt; i++) {
  194.     m = pnt->ID ;
  195.     if (!(pnt++)->Readable) continue ;
  196.     if (tag[m]) {
  197.         point = (OBJECT_STRUCT*)point_to_object(m) ;
  198.         if (((point->Location == n)&&(point->Type == Z_unmovable))
  199.             ||(point->Location == B_have)) rdtxt(m) ;
  200.         else {
  201.             if (point->Type == Z_unmovable) {
  202.                 sw_no_see = TRUE ;
  203.                 continue ;
  204.             }
  205.             else
  206. printf ("I can't read it because it isn't in my possession. \n");
  207.         }
  208.         return ;
  209.     }
  210. }
  211.  
  212. /* Deal with unreadable objects */
  213. if (sw_no_see) printf ("I don't see how I can read that.\n") ;
  214. else printf("There is no way in which I can read that. \n");
  215. return ;
  216.  
  217. } /* --- end of the subroutine "reader" --- */
  218.  
  219. #if (PROTOTYPE)
  220. void locker(int n)
  221. #else
  222. locker(n)
  223. int n ;
  224. #endif
  225. /*****************************/
  226. /*     "lock" command        */
  227. /*      Version: Mk 1.0      */
  228. /*      27 January 1992      */
  229. /*****************************/
  230. {
  231. if (tag[V_VERB_ONLY]) {
  232.     printf ("What do you want me to lock? \n");
  233.     return; 
  234. }
  235.  
  236. if (room[n][M_unmov_obj]) {
  237.     switch (n) {
  238.  
  239.     /* Managers office */
  240.     case R_office_mang:
  241. if (tag[V_safe]) {
  242.     if (Picture->Status == S_open) { 
  243.         if (tag[V_key]) {
  244. printf("You can't lock a combination safe with a key (no keyhole)!\n") ;
  245.             return ;
  246.         }
  247.  
  248.         switch (Safe->Status) { 
  249.         case S_open:
  250. printf("You close the safe and it locks with a \"click\". \n");
  251.             break ;
  252.  
  253.         case S_dialed:
  254. printf("You give the safe's dial a twist, locking the safe. \n");
  255.             break ;
  256.  
  257.         default:
  258.             printf("The safe is already locked!\n") ;
  259.             return ;
  260.         }
  261.         Safe->Status = S_closed ;
  262.     }
  263.     else printf("I don't see a safe to lock.\n") ;
  264. }
  265. else  printf("You're wasting your time.  You can't lock that! \n");
  266. return;
  267.  
  268.     /* office entrance */
  269.     case R_office_entr:
  270.     if (tag[V_door]) {
  271.         if (tag[V_key]) {
  272.             if (Key->Location != B_have) {
  273. printf("You don't have the key to this door in your possession! \n");
  274.                 return ;
  275.             }
  276.         }
  277.         else {
  278.             printf ("With what shall I lock the door? \n");
  279.             return;
  280.         }
  281.  
  282.         switch(Door->Status) {
  283.         case S_open:
  284. printf("You close the door and turn the key in the lock, locking the door.\n") ;
  285.             break ;
  286.         
  287.         case S_kicked:
  288. printf("The door has been kicked in! It'll never be locked again.\n");
  289.             return;
  290.         
  291.         case S_unlocked:
  292.         /* The door is closed but unlocked */
  293. printf("You turn the key in the lock, locking the door.\n") ;
  294.             break ;
  295.         } /* end of the office entrance "switch" block */
  296.  
  297.         room[R_office_entr][2] = R_WALL ;
  298.         Door->Status = S_closed ;
  299.         return; 
  300.     }
  301.  
  302.     default:
  303. printf("I don't think that is the sort of thing one locks.\n") ;
  304.     }  /* end of "lock" room scan switch */
  305. } /* end of "unmovable action device" block */
  306. else printf("There is nothing here that can be locked! \n");
  307. return ;
  308. }  /* --- end of the "locker" subroutine --- */
  309.  
  310.  
  311. #if (PROTOTYPE)
  312. void unlocker(int n)
  313. #else
  314. unlocker(n)
  315. int n ;
  316. #endif
  317. /*****************************/
  318. /*     "unlock" command      */
  319. /*      Version: Mk 1.1      */
  320. /*      16 September 1989    */
  321. /*****************************/
  322. {
  323.  
  324. if (tag[V_VERB_ONLY]) {
  325.     printf ("What do you want me to unlock? \n");
  326.     return; 
  327. }
  328.  
  329. if (room[n][M_unmov_obj]) {
  330.     switch (n) {
  331.  
  332.     /* Managers office */
  333.     case R_office_mang:
  334.         if (tag[V_safe]) {
  335.             if (Picture->Status == S_open) { 
  336. printf("This is a combination type safe (no key hole).  You must\n");
  337. printf("dial a combination in order to open this safe. \n");
  338.             }
  339.             else printf("I don't see a safe to unlock.\n") ;
  340.         }
  341.         else 
  342. printf("You're wasting your time.  You can't unlock that! \n");
  343.         return;
  344.  
  345.     /* office entrance */
  346.     case R_office_entr:
  347.     if (tag[V_door]) {
  348.         switch(Door->Status) {
  349.         case S_open:
  350.             printf("The door is already open! \n");
  351.             return;
  352.         
  353.         case S_kicked:
  354.             printf("The door has been kicked in! \n");
  355.             return;
  356.         
  357.         case S_unlocked:
  358. printf("The door is already unlocked.  However it is still closed! \n");
  359.             return;
  360.         } /* end of the office entrance "switch" block */
  361.  
  362.         /* The door has to still be unlocked */
  363.         if (tag[V_key]) {
  364.         if (Key->Location != B_have) {
  365. printf("You don't have the key to this door in your possession! \n");
  366.         }
  367.         else {
  368.             printf("You turn the key in the lock and ") ;
  369.             printf("hear a satisfying \"click\".\n");
  370.             Door->Status = S_unlocked ;
  371.         }
  372.         }
  373.         else printf ("With what shall I unlock the door? \n");
  374.         return; 
  375.     }
  376.  
  377.     default:
  378. printf("I don't think that is the sort of thing one unlocks.\n") ;
  379.     }  /* end of "unlock" room scan switch */
  380. } /* end of "unmovable action device" block */
  381. else printf("There is nothing here that can be unlocked! \n");
  382. return ;
  383. }  /* --- end of the "unlocker" subroutine --- */
  384.  
  385. #if (PROTOTYPE)
  386. void closer(int n)
  387. #else
  388. closer(n)
  389. int n ;
  390. #endif
  391. /*****************************/
  392. /*     "close" command       */
  393. /*     Version:  Mk 1.0      */
  394. /*     12 November 1988      */
  395. /*****************************/
  396. {
  397.  
  398. /* scan "close" sentence */
  399. if (!room[n][M_unmov_obj]) {
  400. printf("There is nothing here that can be closed! \n");
  401.     return; 
  402. }
  403.  
  404. if (tag[V_VERB_ONLY]) {
  405.     printf ("What exactly do you want me to close? \n");
  406.     return; 
  407. }
  408.  
  409. switch (n) {
  410.     /* office door */
  411.     case R_office_entr:
  412.         if (!tag[V_door]) break ;
  413.  
  414.         switch (Door->Status) {
  415.         case S_kicked:
  416. printf("The door has been kicked in!  It'll never be closed again.\n");
  417.             return;
  418.         
  419.         case S_open:
  420.             if (tag[V_key]) {
  421.                 if (Key->Location != B_have) {
  422. printf("You don't have the key to this door in your possession! \n");
  423.                 }
  424.                 else {
  425. printf("You close the office door and lock it with the key.\n") ;
  426.                     room[R_office_entr][2] = R_WALL ;
  427.                     Door->Status = S_closed ;
  428.                 }
  429.                 return ;
  430.             }
  431.             printf("The office door closes with a slam. \n");
  432.             Door->Status = S_unlocked ;
  433.             return ;
  434.         
  435.         default:
  436.             printf("The office door is already closed! \n");
  437.             return ;
  438.         } /* end of the door status switch */
  439.  
  440.     /* managers office */
  441.     case R_office_mang:
  442.     if ((!tag[V_picture])&&(!tag[V_safe])) break;
  443.     if (tag[V_safe]) {
  444.         if (Safe->Status != S_open) 
  445.         printf("The safe is already closed. \n");
  446.         else {
  447.     printf("The safe door closes and locks with a \"click\". \n");
  448.             Safe->Status = S_closed ;
  449.         }
  450.     }
  451.     if (tag[V_picture]) {
  452.         if (Picture->Status == S_closed) 
  453.         printf("The platypus picture is already closed. \n");
  454.         else  {
  455. printf("The picture swings flush against the wall, hiding the safe.\n");
  456.             Picture->Status = S_closed ;
  457.         }
  458.     }
  459.     return ;
  460.  
  461. } /* end of the "close" switch */
  462.  
  463. printf ("I really don't see how one would close that? \n");
  464. return; 
  465. } /* --- end of the "closer" subroutine --- */
  466.  
  467. #if (PROTOTYPE)
  468. void opener(int n)
  469. #else
  470. opener(n)
  471. int n ;
  472. #endif
  473. /*****************************/
  474. /*      "open" command       */
  475. /*     Version:  Mk 2.1      */
  476. /*     25 April 1990         */
  477. /*****************************/
  478. {
  479. register int i, j ;
  480. int sw_found ;
  481.  
  482. OBJECT_STRUCT *pnt, *point ;
  483.  
  484. #if (PROTOTYPE)
  485. void boom(void), ender(int), gleeper(int) ; 
  486. void objector(OBJECT_STRUCT*) ;
  487. #endif
  488.  
  489. /* deal with a terse command */
  490. if (tag[V_VERB_ONLY]) {
  491.     printf ("What exactly do you want me to open? \n");
  492.     return;
  493. }
  494.  
  495. if (tag[V_can]) {
  496.     if (Can->Location == B_have) 
  497. printf("Some bugger has already drunk it up. The stubee is empty!\n");
  498.     else printf("You don't have a can to open! \n") ;
  499.     return; 
  500. }
  501.  
  502. if (tag[V_letter]) {
  503.     if (Letter->Location == B_have) {
  504.         boom() ; /* cause an explosion */
  505. printf("It's not polite to read other people's mail!!  As you lay\n") ;
  506. printf("bleeding on the floor with your hands and arms blown away,\n") ;
  507. printf("you realize that envelope actually contained a letter bomb!\n");
  508. printf("(A trick widely used by terrorists in the 1970s).  However\n");
  509. printf("the knowledge does you little good since your spirit soon\n");
  510. printf("departs this mortal coil.\n");
  511.         ender(F_died) ;
  512.     }
  513.     else printf("You don't have a letter to open!\n") ;
  514.     return ;
  515. }
  516.  
  517. if (tag[V_bottle]) {
  518.     if (Bottle->Location == B_have)
  519. printf("Some bugger has already drunk it up. The bottle is Empty! \n");
  520.     else printf("You don't have a bottle to open! \n") ;
  521.     return; 
  522. }
  523.  
  524. if (tag[V_umbrella]) {
  525.     if (Umbrella->Location == B_have) {
  526. printf("You open the umbrella but find it's full of holes and\n");
  527. printf("its clasp is broken.  As soon as you release it, the\n");
  528. printf("umbrella snaps shut.\n") ;
  529.     }
  530.     else printf("You don't have an umbrella to open! \n") ;
  531.     return; 
  532. }
  533.  
  534. /* Now check to see if the location is consistent with the command */
  535. if (!room[n][M_unmov_obj]) {
  536.     printf ("I don't understand what you want me to open. \n") ;
  537.     return ;
  538. }
  539.  
  540. switch (n) {
  541.     /* office entrance (door) */
  542.     case R_office_entr:
  543.         if (tag[V_door]) {
  544.         switch (Door->Status) {
  545.             case S_kicked:
  546. printf("The door has been kicked in!  You don't need to open it.\n");
  547.                 return;
  548.         
  549.             case S_open:
  550.                 printf("The door is already open! \n");
  551.                 return ;
  552.         
  553.             case S_unlocked:
  554. printf("As you push open the office door, the rusty hinges creak \n");
  555. printf("from long disuse.  Darkness and stale air seem to exude \n");
  556. printf("from the vacant office.  The way is free for you to enter. \n");
  557.                 room[R_office_entr][2] = R_office_hall ;
  558.                 Door->Status = S_open ;
  559.                 return ;
  560.         
  561.             case S_closed:
  562.                 if (tag[V_key]) {
  563. if (Key->Location != B_have) {
  564.     printf("You don't have the key to this door in your possession! \n");
  565. }
  566. else {
  567. printf("You turn the key in the lock and hear a satisfying \"click\".\n");
  568. printf("Then you push open the office door, the rusty hinges creak \n");
  569. printf("from long disuse.  Darkness and stale air seem to exude \n");
  570. printf("from the vacant office.  The way is free for you to enter. \n");
  571.     room[R_office_entr][2] = R_office_hall ;
  572.     Door->Status = S_open ;
  573. }
  574.                 }
  575.                 else {
  576. printf("The office door is locked tight.");
  577. printf("  You need to unlock it with a key. \n");
  578.                 }
  579.                 return ;
  580.         } /* end of room status switch */
  581.         } /* end of the door "if" block */
  582.         break ;
  583.  
  584.     /* managers office */
  585.     case R_office_mang:
  586.         if ((!tag[V_picture])&&(!tag[V_safe])) {
  587. printf("I don't understand how I would open that.\n") ;
  588.             return ;
  589.         }
  590.  
  591.         if (tag[V_picture]) {
  592.             if (Picture->Status == S_closed) {
  593. printf("You swing open the platypus picture revealing a large wall \n");
  594. printf("safe with a combination dial. \n");
  595.                 Picture->Status = S_open ;
  596.             }
  597.             else {
  598.                 if (Safe->Status == S_closed) {
  599. printf("The picture is already swung out.  The problem is to open \n");
  600. printf("the safe!!  Hint:  Dial in a combination. \n");
  601.                 }
  602.                 else {
  603. printf("The picture is already swung out.\n");
  604.                 }
  605.             }
  606.             return ;
  607.         } /* end of the picture "if" block */
  608.  
  609.         if (tag[V_safe]) {
  610.             if (Picture->Status == S_closed) {
  611. printf("I do not see a safe in this office for me to open.  Perhaps\n");
  612. printf("there is a safe hidden in this office somewhere.\n");
  613.                 return ;
  614.             }
  615.  
  616.         switch (Safe->Status) {
  617.         case S_closed:
  618. printf("The safe is locked.  You must first dial the combination\n");
  619. printf("in order to open it.  See if you can find the combination. \n");
  620.             return ;
  621.         
  622.         case S_dialed:
  623.     printf("The safe door swings open smoothly and easily. \n");
  624.             Safe->Status = S_open ;
  625.             sw_active = TRUE ;
  626.             sw_found = FALSE ;
  627.             point = object ;
  628.             for (j = 0; j < Objcnt; j++) {
  629.             if ((point++)->Location == B_in_safe) {
  630. printf("Inside the safe, you see the following: \n");
  631.                 sw_found = TRUE ;
  632.                 pnt = object ;
  633.                 for (i = 0; i < Objcnt; i++) {
  634.                     if (pnt->Location == B_in_safe) {
  635.                         printf ("        ") ;
  636.                         objector(pnt);
  637.                         printf("\n") ;
  638.                     }
  639.                     pnt++ ;
  640.                 }                
  641.                 break ;
  642.             }
  643.             }
  644.             if (gleep_safe != 0) {
  645.                 if (sw_found) {
  646.                     if (gleep_safe == 1) 
  647. printf("        one gleep\n") ;
  648.                     else
  649. printf("        %d gleeps\n", gleep_safe) ;
  650.                 }
  651.                 else {
  652.                     if (gleep_safe == 1) 
  653. printf("Inside the safe is one gleep.\n") ;
  654.                     else
  655. printf("Inside the safe are %d gleeps.\n", gleep_safe) ;
  656.                     sw_found = TRUE ;
  657.                 }
  658.             }
  659.             if (!sw_found) printf("---The safe is empty.--- \n");
  660.             return ;
  661.  
  662.         case S_open:
  663.             printf("The safe is already open! \n");
  664.             return ;
  665.         } /* end of the "safe" status switch */
  666.         } /* end of the safe "if" block */
  667.         return ; /* this return statement must remain */
  668.  
  669.     /* Lift door(s) */
  670.     case R_lift_entr:
  671.         if (tag[V_door]||tag[V_lift]) {
  672. printf("It is not exactly clear how I would open these doors.\n") ;
  673. printf("However I see a push button next to the lift doors.\n") ;
  674. printf("Perhaps if I pressed the button something would happen.\n") ;
  675.         }
  676.         else printf("I'm confused about what I should open.\n");
  677.         return ;
  678.         
  679. } /* end of the "open" room switch */
  680. printf ("I see nothing here that I can open. \n") ;
  681. } /* --- end of the "opener" subroutine --- */
  682.  
  683. #if (PROTOTYPE)
  684. void boom(void)
  685. #else
  686. boom()
  687. #endif
  688. {
  689. printf("\n\n");
  690. printf("BBBBBB      OOOOO        OOOOO      MM        MM      !!!\n");
  691. printf("B    BB   OO     OO    OO     OO    M M      M M      !!!\n");
  692. printf("B    BB   OO     OO    OO     OO    M  M    M  M      !!!\n");
  693. printf("BBBBBB    OO     OO    OO     OO    M   M  M   M      !!!\n");
  694. printf("B    BB   OO     OO    OO     OO    M    MM    M      !!!\n");
  695. printf("B    BB   OO     OO    OO     OO    M          M\n");
  696. printf("BBBBBB      OOOOO        OOOOO      M          M      !!!\n\n");
  697. } /* --- end of the "boom" subroutine --- */
  698.  
  699. #if (PROTOTYPE)
  700. void gleeper(int n)
  701. #else
  702. gleeper(n) 
  703. int n ;
  704. #endif
  705. /********************************************/
  706. /*                                          */
  707. /*           Gleeper Subroutine             */
  708. /*                                          */
  709. /*     Software by Gary A. Allen, Jr.       */
  710. /*           Version: Mk 1.00               */
  711. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  712. /*                                          */
  713. /********************************************/
  714. {
  715. register int i ;
  716. int count ;
  717. static int sw_glp_st = FALSE, cnt_down = 0 ;
  718.  
  719. /* Gleep display routine */
  720. count = room[n][M_gleep] ;
  721.  
  722. if (((Torch->Location == B_have)&&Torch->Status)
  723.         ||(n < 186)||(n > 202)) { 
  724.     if (count != 0) {
  725.         sw_glp_st = TRUE ; /*  gleeps can now multiply */
  726.         if (count != 1) 
  727.                printf("There are %d gleeps here. \n",count) ;
  728.         else printf("There is a gleep here. \n") ;
  729.         return ;
  730.     }
  731. }
  732.  
  733. /* Gleep reproduction routine */
  734. if (sw_glp_st == TRUE) {
  735.     if (++cnt_down > 5) {
  736.         cnt_down = 0 ;
  737.         for (i = 0; i <= 9; i++) {
  738.             if (room[gleep_spot[i]][M_gleep] == 0) continue;
  739.             if (room[gleep_spot[i]][M_gleep] > 10000) 
  740.                 ++room[gleep_spot[i]][M_gleep] ;
  741.             else room[gleep_spot[i]][M_gleep] <<= 1 ;
  742.         }
  743.     }
  744. }
  745. } /* --- end of "gleeper" subroutine --- */
  746.  
  747. #if (PROTOTYPE)
  748. void clip_in(int ammo_flag)
  749. #else
  750. clip_in(ammo_flag)
  751. int ammo_flag ;
  752. #endif
  753. /********************************************/
  754. /*                                          */
  755. /*            Clip_In Subroutine            */
  756. /*                                          */
  757. /*     Software by Gary A. Allen, Jr.       */
  758. /*           Version: Mk 2.00               */
  759. /* (c) Copyright 1990 by Gary A. Allen, Jr. */
  760. /*                                          */
  761. /********************************************/
  762. {
  763. /* ammo clip insertion routine */
  764. if (Rifle->Location != B_have) {
  765. printf("Galah!!  You don't have a rifle to put an ammo clip into.\n");
  766.     return ;
  767. }
  768. if (clip_flag != F_no_clip) {
  769. printf("There is already an ammo clip in the rifle. \n") ;
  770.     return ;
  771. }
  772. if (((Clip->Location != B_have)&&(ammo_flag == F_normal_clip))
  773.     ||((Org_clip->Location != B_have)&&(ammo_flag == F_org_clip))) {
  774. printf("You don't possess an ammo clip to put into the rifle.\n");
  775.     return ;
  776. }
  777. /* actually load the clip into the rifle */
  778. Rifle->Type = Z_alias ;
  779. carry_count-- ;
  780. carry_weight -= Clip->Weight  ;
  781. if (ammo_flag == F_normal_clip) {
  782.     Clip->Location = B_unmade ;
  783.     clip_flag = F_normal_clip ;
  784.     Rifle->Status  = Clip->Status ;
  785. }
  786. else {
  787.     Org_clip->Location = B_unmade ;
  788.     clip_flag = F_org_clip ;
  789.     Rifle->Status = Org_clip->Status ;
  790. }
  791. printf("The ammunition clip slides into the rifle with a \"click\".\n");
  792. printf("You have %d bullets in the clip \n",
  793.             Rifle->Status) ;
  794. if (Rifle->Status > 0) 
  795.     printf("You cycle the M16's bolt once to chamber a round.\n");
  796. return ;
  797. } /* --- end of the "clip_in" subroutine --- */
  798.  
  799. #if (PROTOTYPE)
  800. void clip_out(int n)
  801. #else
  802. clip_out(n)
  803. int n ;
  804. #endif
  805. /********************************************/
  806. /*                                          */
  807. /*           Clip_Out Subroutine            */
  808. /*                                          */
  809. /*     Software by Gary A. Allen, Jr.       */
  810. /*           Version: Mk 1.00               */
  811. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  812. /*                                          */
  813. /********************************************/
  814. {
  815. int ammo_flag ; 
  816.  
  817. /* remove clip from rifle */
  818. if (Rifle->Location != B_have) {
  819.     printf("You Bloody Galah!  ") ;
  820.     printf("You don't have a rifle in your possession!\n");
  821.     return ;
  822. }
  823. if (clip_flag == F_no_clip) {
  824.     printf("There is no clip in the rifle. \n") ;
  825.     return ;
  826. }
  827. /* eject the clip from the rifle */
  828. Rifle->Type = Z_normal ;
  829. if (clip_flag == F_normal_clip) {
  830.     Clip->Location = n ;
  831.     ammo_flag = F_normal_clip ;
  832. }
  833. else {
  834.     Org_clip->Location = n ;
  835.     ammo_flag = F_org_clip ;
  836. }
  837. ++room[n][M_obj_cnt] ;
  838. clip_flag = F_no_clip ;
  839. printf("You press the \"eject\" button on the rifle and the ") ;
  840. printf("magazine falls to the ground.\n") ;
  841.  
  842. if (Rifle->Status > 0) {
  843. printf("You then cycle the M16's bolt once to clear the chamber. ");
  844. printf("The unfired round\n") ;
  845. printf("is ejected from the breech and rolls out of sight. \n") ;
  846.     if (ammo_flag == F_normal_clip) Clip->Status = --Rifle->Status ;
  847.     else Org_clip->Status = --Rifle->Status ;
  848. }
  849. else {
  850.     if (ammo_flag == F_normal_clip) Clip->Status = 0 ;
  851.     else Org_clip->Status = 0 ;
  852. }
  853. Rifle->Status = 0 ;
  854. return ;
  855. } /* --- end of the "clip_out" subroutine --- */
  856.  
  857. #if (PROTOTYPE)
  858. void igniter(int n)
  859. #else
  860. igniter(n)
  861. int n ;
  862. #endif
  863. /********************************************/
  864. /*                                          */
  865. /*           Igniter Subroutine             */
  866. /*                                          */
  867. /*     Software by Gary A. Allen, Jr.       */
  868. /*           Version: Mk 1.00               */
  869. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  870. /*                                          */
  871. /********************************************/
  872. {
  873. #if (PROTOTYPE)
  874. void switcher(int) ;
  875. long time(long*) ;
  876. #else
  877. long time() ;
  878. #endif
  879.  
  880. /* reject single verb command */
  881. if (tag[V_VERB_ONLY]) {
  882.     printf("What exactly do you want me to set alight?\n") ;
  883.     return ;
  884. }
  885.  
  886. /* deal with 'light torch' command */
  887. if (tag[V_torch]) {
  888.     switcher(n) ;
  889.     return ;
  890. }
  891.  
  892. /* see if the player has or requested matches */
  893. if (!tag[V_match]) {
  894.     printf("What am I to light it with?\n") ;
  895.     printf("(I am not prepared to rub two sticks together.)\n") ;
  896.     return ;
  897. }
  898. if (Matches->Location != B_have) {
  899.     printf("I have no matches!\n") ;
  900.     return ;
  901. }
  902. else {
  903. /* reject spurious "ignite" command */
  904.     if ((!tag[V_cap])&&(!tag[V_dynamite])
  905.         &&(sent[2] != V_LINE_END)) {
  906. printf("It would be a fire hazard to set that alight.\n");
  907.         return ;
  908.     }
  909.  
  910. /* deal with spurious "light dynamite with match" */
  911. if (tag[V_dynamite]&&(Dynamite->Location != B_have)) {
  912.     printf("You have no dynamite to ignite.\n") ;
  913.     return ;
  914. }
  915.  
  916. /* deal with spurious "light cap with match" */
  917. if (tag[V_cap]&&(Dynamite->Location != B_have)
  918.     &&(Cap->Location != B_have)) {
  919. printf("You don't have one to ignite.\n") ;
  920.     return ;
  921. }
  922.  
  923. /* light up the match(es) */
  924.     if (tag[V_PLURAL]) {
  925. printf("You open up the match box and strike ALL of the matches.\n");
  926.         Matches->Location = B_destroyed ;
  927.     }
  928.     else {
  929. printf("You take one match from the match box and ignite it.\n") ;
  930.     }
  931. }
  932.  
  933. /* see if player selected burnable objects */
  934. if (tag[V_cap]&&(Cap->Location == B_have)) {
  935. printf("You then ignite the fuse of the blasting cap.\n\n"); 
  936. printf("Ssssssssssssssssssssssss........\n");
  937.     clock_explode = time(0) + 11 ;
  938.     sw_clock = TRUE ;
  939.     flag_clock = V_cap ;
  940.     return ;
  941. }
  942.  
  943. if ((tag[V_cap]||tag[V_dynamite])&&
  944.     (Dynamite->Location == B_have)) {
  945.     if (Dynamite->Type == Z_alias) {
  946. printf("You then ignite the fuse of the dynamite's blasting cap....\n");
  947. printf("You need to very quickly get very far away from this thing!!");
  948. printf("\n\nSsssssssssssssssssssssss........\n");
  949.         clock_explode = time(0) + 11 ;
  950.         sw_clock = TRUE ;
  951.         flag_clock = V_dynamite ;
  952.          return ;
  953.     }
  954.     else {
  955. printf("You then ignite the dynamite. Which is an odd thing\n"); 
  956. printf("to do since it doesn't have a blasting cap in it.  The\n");
  957. printf
  958.   ("\"dynamite\" (which is actually a very safe mining explosive)\n");
  959. printf("burns for a few minutes, billowing out smelly black smoke\n");
  960. printf("and eventually goes out leaving a few scant ashes behind.\n") ;
  961.         Dynamite->Location = B_destroyed ;
  962.          return ;
  963.     }
  964. }
  965.  
  966. } /* -- end of the "igniter" subroutine --- */
  967.  
  968. #if (PROTOTYPE)
  969. void hold_it(void)
  970. #else
  971. hold_it()
  972. #endif
  973. /********************************************/
  974. /*                                          */
  975. /*            Wait Subroutine               */
  976. /*                                          */
  977. /*     Software by Gary A. Allen, Jr.       */
  978. /*           Version: Mk 1.00               */
  979. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  980. /*                                          */
  981. /********************************************/
  982. {
  983. char chr ;
  984. #if (PROTOTYPE)
  985. char getch(void) ;
  986. #endif
  987.  
  988. #ifdef __TURBOC__
  989. /* Stop scrolling the screen until the user is ready */
  990. printf("               [Press any key to continue]\r") ;
  991. chr = getch() ;
  992. printf("                                          \n") ;
  993. #endif
  994.  
  995. #ifndef __TURBOC__
  996. printf("               [Press RETURN to continue]\n") ;
  997. chr = getchar() ;
  998. #endif
  999.  
  1000. chr = chr ; /* just to keep Lint happy */
  1001.  
  1002. } /* --- end of the "hold_it" subroutine --- */
  1003.  
  1004. #if (PROTOTYPE)
  1005. void eater(void)
  1006. #else
  1007. eater()
  1008. #endif
  1009. /********************************************/
  1010. /*                                          */
  1011. /*            Eater Subroutine              */
  1012. /*                                          */
  1013. /*     Software by Gary A. Allen, Jr.       */
  1014. /*           Version: Mk 1.00               */
  1015. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  1016. /*                                          */
  1017. /********************************************/
  1018. {
  1019.  
  1020. #if (PROTOTYPE)
  1021. void ender(int) ;
  1022. #endif
  1023.  
  1024. /* reject single verb command */
  1025. if (tag[V_VERB_ONLY]) {
  1026.     printf("What exactly do you want me to swallow?\n") ;
  1027.     return ;
  1028. }
  1029.  
  1030. /* deal with "eat (atropine) pill(s)" command */
  1031. if (tag[V_pill]) {
  1032.     if (Pills->Location != B_have) {
  1033. printf("You don't have the atropine pills in your possesion!\n") ;
  1034.         return ;
  1035.     }
  1036.     if (tag[V_PLURAL]) {
  1037. printf("You remove ALL of the pills from the packet and swallow\n");
  1038. printf("the lot.  For a couple of minutes nothing happens, then you\n");
  1039. printf("start seeing double and have nervous twitches. You then\n");
  1040. printf("start shaking violently and collapse to the ground.\n") ;
  1041. printf("Eventually you pass out and expire from atropine poisoning.\n");
  1042.         ender(F_died) ;
  1043.     }
  1044.     if (--pill_count <= 0 ) {
  1045.         Pills->Location = B_destroyed ;
  1046.         carry_count-- ;
  1047.         carry_weight -= Pills->Weight  ;
  1048. printf("You swallow the last atropine pill and throw away the empty\n");
  1049. printf("packet which disappears from sight.  ") ;
  1050.     }
  1051. else printf("You swallow one atropine pill.  ") ;
  1052.         i_poison += 10 ;
  1053.         if (i_poison >= 30) {
  1054. printf("\nAfter a moment you have a violent seizure and die.\n") ;
  1055.             ender(F_died) ;
  1056.         }
  1057.         if (i_poison >= 20) {
  1058. printf("\nYou begin to shake violently and can barely stand.\n") ;
  1059.             return ;
  1060.         }
  1061.         if (i_poison >= 15) {
  1062. printf("\nYour hands become a bit jittery and your vision blurred.\n") ;
  1063.             return ;
  1064.         }
  1065.         printf("The drug has no ill effect.\n") ;
  1066.     return ;
  1067. }
  1068. else 
  1069. printf("I am not inclined towards putting that into my mouth!\n") ;
  1070.  
  1071. } /* --- end of the "eater" subroutine --- */
  1072.  
  1073. #if (PROTOTYPE)
  1074. void ender(int i_quit)
  1075. #else
  1076. ender(i_quit)
  1077. int i_quit ;
  1078. #endif
  1079. /********************************************/
  1080. /*                                          */
  1081. /*            Ender Subroutine              */
  1082. /*                                          */
  1083. /*     Software by Gary A. Allen, Jr.       */
  1084. /*           Version: Mk 1.00               */
  1085. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  1086. /*                                          */
  1087. /********************************************/
  1088. {
  1089. #if (PROTOTYPE)
  1090. void hold_it(void), new_score(void), exit(int) ;
  1091. #endif
  1092.  
  1093. /* get last score */
  1094. new_score() ;
  1095.  
  1096. if (Tank->Status != 0) sw_active = TRUE ; 
  1097.  
  1098. if (i_quit == F_died) { 
  1099.     hold_it() ;
  1100.     score -= 100 ;
  1101. printf ("\nOh Dear!  You've just turned yourself into a corpse! \n\n");
  1102. printf ("For getting killed you lose 100 points. \n\n") ;
  1103. }
  1104.  
  1105. /* Scoring Block */
  1106. for(;;) {
  1107. if (!sw_active) {
  1108.     if (score == 0) { 
  1109.         printf("You concluded the game with no points.  ") ; 
  1110.         printf("What a pitiful performance!!\n") ;
  1111.     }
  1112.     else {
  1113. printf("You concluded the game with a miserable negative score\n") ;
  1114. printf("of %d points.  Your score was better BEFORE you \n",score);
  1115. printf("started playing (need I say more on how this reflects\n");
  1116. printf("upon your limited aptitude at Dinkum).\n") ;
  1117.     }
  1118.     break ;  /* drop out of the scoring block */
  1119. }
  1120.  
  1121. if (score == 0)  {
  1122. printf("You concluded the game with no points ") ;
  1123.     if (Tank->Status == 0) { 
  1124. printf("and didn't drop a single gleep\n") ;
  1125. printf("into the gleep tank. The word \"embarrassing\" sums it up!\n") ;
  1126.     }
  1127.     else {
  1128.         if (Tank->Status > 1) {
  1129. printf("but you did put %d gleeps\n",Tank->Status) ;
  1130. printf("into the gleep tank.\n") ;
  1131.         }
  1132.         else {
  1133. printf("but you did manage to find a gleep\n") ;
  1134. printf("and put it in the gleep tank, (Hah!! What an achievement!).\n");
  1135.         }
  1136.     }
  1137. }
  1138.  
  1139. else {
  1140. if (score > 0)
  1141. printf ("You concluded the game with %d points",score);
  1142. else {
  1143. printf("You concluded the game with a miserable negative score\n") ;
  1144. printf("of %d points.  Your score was better BEFORE you \n",score);
  1145. printf("started playing (need I say more on how this reflects\n");
  1146. printf("upon your limited aptitude at Dinkum).  You ") ;
  1147.     if (Tank->Status == 0) { 
  1148. printf("also failed to\nget any gleeps into the tank.  At least ");
  1149. printf("you're consistent.\n\n") ;
  1150.     }
  1151.     else {
  1152. printf("managed\nto get something into the gleep tank.  However ");
  1153. printf("it hardly\nmatters, considering your poor score.\n\n") ;
  1154.     }
  1155.     break ;  /* drop out of the scoring block */
  1156. }
  1157.     if (Tank->Status == 0) 
  1158. printf(".\nHowever you placed no gleeps in the gleep tank.\n") ;
  1159.     else {
  1160.         if (Tank->Status > 1) {
  1161. printf (" and placed %d gleeps\n",Tank->Status) ;
  1162. printf ("in the gleep tank.  Good on you, Mate!\n") ;
  1163.         }
  1164.         else {
  1165. printf(" but you did manage to find a gleep\n") ;
  1166. printf("and put it in the gleep tank.\n") ;
  1167.         }
  1168.     }
  1169. }
  1170. break ;  /* drop out of the scoring block */
  1171. } /* end of the ifinite "for" loop scoring block */
  1172.  
  1173. /* Closing Remark */
  1174. printf("\nDinkum has ended.  If you are interested in more ") ;
  1175. printf("information\nabout this program type:    dinkum -h\n") ;
  1176. exit(0);
  1177.  
  1178. } /* --- end of "ender" routine --- */
  1179.  
  1180. #if (PROTOTYPE)
  1181. OBJECT_STRUCT* point_to_object(int find_id)
  1182. #else
  1183. OBJECT_STRUCT* point_to_object(find_id)
  1184. int find_id ;
  1185. #endif
  1186. /*****************************/
  1187. /*  Object Pointer Function  */
  1188. /*     Version:  Mk 1.0      */
  1189. /*      9 January 1993       */
  1190. /*****************************/
  1191. {
  1192.  
  1193. register int i;
  1194. OBJECT_STRUCT *pnt ;
  1195.  
  1196. #if (PROTOTYPE)
  1197. void bugs(int) ;
  1198. #endif
  1199.  
  1200. pnt = object ;
  1201. for (i = 0; i < Objcnt; i++) {
  1202.     if (pnt->ID == find_id) return(pnt) ;
  1203.     pnt++ ;
  1204. }
  1205. printf("Run time error detected in \"point_to_object\" function.\n") ;
  1206. printf("\"find_id\" value was %d.\n", find_id) ;
  1207. bugs(Logic_error) ;
  1208. return(pnt) ;  /* this is just a dummy return for Lint */
  1209.  
  1210. } /* --- end of "point_to_object" function --- */
  1211.  
  1212.